/*
    编写函数把一个数组中所有存储区的内容前后颠倒
*/
#include <stdio.h>
void change(int *p_arr, int size) {
    /*int tmp = 0, num = 0;
    for (num = 0; num <= size / 2; num++) {
	tmp = *(p_arr + (size - 1- num));
	*(p_arr + (size - 1 - num)) = *(p_arr + num);
	*(p_arr + num) = tmp;
    }*/
    int *p_pre = p_arr, *p_post = p_arr + size - 1;
    while (p_pre < p_post) {
	int tmp = *p_pre;
	*p_pre = *p_post;
	*p_post = tmp;
	p_pre++;
    	p_post--;
    }
}
int main() {
    int arr[] = {1,2,3,4,5,6,7,8,9}, num = 0;
    change(arr, 9);
    for (num = 0; num <= 8; num++) {
	printf("%d ", arr[num]);
    }
    printf("\n");
    return 0;
}
